/**
 * Created by Ysssssss on 20/12/14.
 */
import { formatPrice } from "../../../common/utils";

Component({
    properties: {
        indexStr: {
            type: String,
            value: ''
        },
        standardInfo: {
            type: Object,
            value: {},
        },
        standardError: {
            type: Boolean,
            value: false,
        }
    },
    observers: {
        'standardInfo': function (standardInfo) {
            if (standardInfo) {
                const price = formatPrice(standardInfo.price, true);
                this.setData({ price });
            }
        },
    },
    lifetimes: {
        ready() {

        },
    },
    data: {
        price: '',
    },
    methods: {
        handleStandardPriceChange(e) {
            const { standardInfo } = this.data
            this.triggerEvent('standardChange', {
                ...standardInfo,
                price: formatPrice(e.detail),
            })
            this.setData({
                standardError: false
            })
        }
    }
})